import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:moose_app/ui/values/constants.dart';

class ATHHomeStickyTabBarDelegate extends SliverPersistentHeaderDelegate {
  final TabBar child;

  final Function press;

  ATHHomeStickyTabBarDelegate({@required this.child, this.press});

  @override
  Widget build(
      BuildContext context, double shrinkOffset, bool overlapsContent) {
    return Container(
      color: Colors.white,
      child: Row(
        children: <Widget>[
          Expanded(
            child: this.child,
          ),
          GestureDetector(
            onTap: press,
            child: Container(
              width: kSize80,
              child: SvgPicture.asset(
                'assets/icons/icon_more_menu.svg',
                width: kSize32,
              ),
            ),
          )
        ],
      ),
    );
  }

  @override
  double get maxExtent => this.child.preferredSize.height;

  @override
  double get minExtent => this.child.preferredSize.height;

  @override
  bool shouldRebuild(SliverPersistentHeaderDelegate delegate) {
    return true;
  }
}
